<?php
/**
 * Created by PhpStorm.
 * User: 刘海明（GadflyBSD@gmail.com）
 * Date: 2014/12/29
 * Time: 14:15
 */
function groupsConfig($group){
	$protocol = strpos(strtolower($_SERVER['server_protocol']),'https')  === false ? 'http' : 'https';
	$app_url = $protocol.'://'.$_SERVER['SERVER_NAME'].(($_SERVER['SERVER_PORT']==80)?'':':'.$_SERVER['SERVER_PORT']);
	$modulePath = '//Public/JavaScript/';
	$customPath = '//Public/Custom/';
	$ch = curl_init($app_url.'/custom/'.$group.'/Index/getScriptConf');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_TIMEOUT, 5);
	$loadFile = json_decode(curl_exec($ch), true);
	curl_close($ch);
	foreach($loadFile AS $key => $val){
		$file = array();
		foreach($val AS $v){
			$param = explode('/', $v);
			if($param[0] == 'Module')
				$file[] = $modulePath.$v;
			else
				$file[] = $customPath.$v;
		}
		$return[$key] = $file;
	}
	return $return;
}

$protocol = strpos(strtolower($_SERVER['server_protocol']),'https')  === false ? 'http' : 'https';
$app_url = $protocol.'://'.$_SERVER['SERVER_NAME'].(($_SERVER['SERVER_PORT']==80)?'':':'.$_SERVER['SERVER_PORT']);
echo $app_url.'/custom/'.$_GET['group'].'/Index/getScriptConf';
//print_r(groupsConfig($_GET['group']));